from starlette.endpoints import HTTPEndpoint
from starlette.responses import JSONResponse
from database import Session, engine
import datetime
from dao import DaoBureauMonRep


#供电局指标排名月报
class BureauMonRep(HTTPEndpoint):

    async def get(self, request):
        session = Session()
        try:
            monthnum = request.query_params["monthnum"]
            area_flag = request.query_params["area_flag"]
            return  DaoBureauMonRep.get_monthrep_info(session, monthnum, area_flag)
        finally:
            session.close()